package com.windchime.blog.controller.lib.aly.service.impl;

import com.windchime.blog.controller.lib.aly.service.OssService;
import com.windchime.blog.utils.UploadUtil;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

@Service
public class OssServiceImpl implements OssService {

    /**
     * 上传用户头像到阿里云oss
     * @param file 文件
     * @return url
     */
    @Override
    public String uploadUserAvatar(MultipartFile file) {
        return UploadUtil.upload(file, "userAvatar");
    }

    /**
     * 上传博客封面到阿里云oss
     * @param file 文件
     * @return url
     */
    @Override
    public String uploadBlogCover(MultipartFile file) {
        return UploadUtil.upload(file, "blogCover");
    }

    /**
     * 上传友链封面到阿里云oss
     * @param file 文件
     * @return url
     */
    @Override
    public String uploadFriendCover(MultipartFile file) {
        return UploadUtil.upload(file, "friendCover");
    }

    /**
     * 上传资源封面到阿里云oss
     * @param file 文件
     * @return url
     */
    @Override
    public String uploadResourceCover(MultipartFile file) {
        return UploadUtil.upload(file, "resourceCover");
    }
}
